Modeling/ Constraints

Constraints

 

Assume that you have to create a sphere whose 'x' coordinate always stays right in the middle of the 'x' coordinates of the two other spheres. However, in 'y' and 'z' directions, you should be able to move the sphere without any restrictions.

Constraint objects allow you to set up this kind of relations between objects. To define the relation outlined above:

1. Create three spheres and name them as 'sphere1' 'sphere2' and 'sphere'3

2. Select the three spheres and activate the Constraint tool. You can access this tool from the menu (Tools/Creation/Create constraint). The control bar now shows you available scripting languages. Select 'RPL' and click 'Accept'.

3. Select the created 'constraint' object, open the properties window and go to the 'Script' tab. Enter the following RPL program:
 

"sphere1.Center.x" Get   ( fetch x coord. of center1 )
"sphere2.Center.x" Get   ( fetch x coord of sphere2 )
F+                       ( add )
2.0 F/                   ( divide by two )
"sphere3.Center.x" Set   ( set result to x coord of sphere3)

 
The constraint defines all attributes of the associated objects in its own attribute space.